/**
 * 
 */
package geometrie;

/**
 * @author admin
 *
 */
public class Triangle implements Figure {
	
	private double cote1;
	private double cote2;
	private double cote3;
		
	public double getCote1() {
		return cote1;
	}

	public void setCote1(double cote1) {
		this.cote1 = cote1;
	}

	public double getCote2() {
		return cote2;
	}

	public void setCote2(double cote2) {
		this.cote2 = cote2;
	}

	public double getCote3() {
		return cote3;
	}

	public void setCote3(double cote3) {
		this.cote3 = cote3;
	}
	
	public Triangle(double cote1, double cote2, double cote3) {
		super();
		this.cote1 = cote1;
		this.cote2 = cote2;
		this.cote3 = cote3;
	}

	/* (non-Javadoc)
	 * @see geometrie.Figure#surface()
	 */
	@Override
	public double surface() {
		// TODO Auto-generated method stub
		double perimetre = (getCote1()+getCote2()+getCote3());
		double demiPerimetre = perimetre/2;
		return Math.sqrt(demiPerimetre*(demiPerimetre-getCote1())*(demiPerimetre-getCote2())*(demiPerimetre-getCote3()));
	}

	@Override
	public String toString() {
		return String.format("Triangle [cote1=%f, cote2=%f, cote3=%f]", getCote1(),getCote2(),getCote3());
	}
}
